package com.example.mymatch.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.lang.annotation.Annotation;

/**
 * 对服务接口规范的方法实现
 * 编写者：吴茂景
 */
@Configuration
@EnableWebMvc
public class mySwaggerCon {
    @Bean
    public Docket appApi(){
        return  new Docket(DocumentationType.SWAGGER_2)
                .groupName("faker")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.mymatch.controller"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(appInfo());
    }

    public ApiInfo appInfo(){
        return new ApiInfoBuilder().title("接口管理")
                .contact(new Contact("作者","个人地址","本人邮箱"))
                .version("v01")
                .description("模块说明")
                .build();

    }

}
